(function(){
    $(".bff-login").on('click',function(e) {
        $("#header-login").click();
        e.preventDefault();
    });

    $(".bff-create-trip").on('click',function(e) {
        $(".create-trip-btn").click();
        e.preventDefault();
    });

	function $Slide(o,undefined){
		var othis=this,undefined;
		othis.timeout=null;
		othis._selfID=(++othis.constructor._newNum);
		othis._selfName=".$Slide"+othis._selfID;
		
		if(!o){return;}
		if(o.config!=undefined){
			othis.config=$.extend({},othis.config,o.config);	
		}
		if(o.oslide!=undefined){
			othis.oslide=$(o.oslide);
			othis.oPanel=othis.oslide.find(othis.config.panelSelector);
			othis.oItems=othis.oPanel.find(othis.config.itemsSelector);
			othis.oOptionsCon=othis.oslide.find(othis.config.optionsSelector);
			othis.oOptions=othis.oOptionsCon.find(othis.config.optionSelector);
		}
	}
	$Slide.prototype={
		config:{pos:0,isRandom:false,speed:400,delay:4000,auto:false,moveWay:"moveWidth",itemsSelector:".ui_slide_item",panelSelector:".ui_slide_panel",optionSelector:".ui_slide_option",optionsSelector:".ui_slide_options",optionCSSCurr:"ui_slide_option_curr",itemCSSCurr:"ui_slide_item_curr",itemWidth:0,itemHeight:0,onBeforeMove:null,isDelay:false},
		autoPlay:function(){
			var othis=this;
			clearTimeout(othis.timeout);
			othis.config.pos++;
			othis.move();
			othis.timeout=setTimeout(function(){othis.autoPlay(); return othis.timeout;},othis.config.delay);
		},
		setPos:function(){
			var othis=this;
			othis.config.pos>=othis.sum?othis.config.pos=othis.config.pos-othis.sum:othis.config.pos=othis.config.pos;
		},
		itemsHandler: function(e){
			var othis=e.data;
			clearTimeout(othis.timeout);	
		},
		optionsEnterHandler:function(e){
			var othis=e.data,cfg=othis.config,oself=$(this);
			othis.delayTimeout=setTimeout(function(){ 
				clearTimeout(othis.timeout);
				var index=othis.oOptions.index(oself);
				cfg.pos=index;
				othis.move();				
			},200);		
		},
		leaveHandler:function(e){
			var othis=e.data;
			clearTimeout(othis.delayTimeout);
			if(othis.config.auto){
				clearTimeout(othis.timeout);
				othis.timeout=setTimeout(function(){othis.autoPlay(); return othis.timeout;},othis.config.delay);
			}
		},
		init:function(){
		   var othis=this,cfg=othis.config;
		   var sum=othis.oOptions.length;
		   othis.sum=sum;
		   
		   if(sum==0){othis.oslide.hide();return false;}
		   if(sum==1){
			   othis.oOptions.hide();
			   othis.oItems.addClass(cfg.itemCSSCurr);
			   if(othis.config.isDelay){
				  cfg.pos=0;
				  $(window).bind("resize"+othis._selfName+" scroll"+othis._selfName,othis,othis.fnDelay);
				  othis.fnDelay(); 
			   }
			   return false;
		   }
		   
		   if(cfg.isRandom){
				cfg.pos=Math.floor(othis.sum*Math.random());
		   }
		   
		   othis.setMoveWay();
		   
		   if(othis.config.isDelay){
			  othis.config.onBeforeMove=othis.fnDelay; 
			  $(window).bind("resize"+othis._selfName+" scroll"+othis._selfName,othis,othis.fnDelay);
			  othis.fnDelay();
		   }
		   
		   othis.oItems.mouseenter(othis,othis.itemsHandler);
		   othis.oOptions.mouseenter(othis,othis.optionsEnterHandler);
		   othis.oOptions.mouseleave(othis,othis.leaveHandler);
			
			if(cfg.auto){
				othis.oItems.mouseleave(othis,othis.leaveHandler);
				othis.timeout=setTimeout(function(){othis.autoPlay(); return othis.timeout;},cfg.delay);	
			}			
		},
		move:function(){
			if(this.config.onBeforeMove){
				this.onBeforeMove=this.config.onBeforeMove;
				this.onBeforeMove();	
			}	
			this.movefunc();		
		},
		setMoveWay:function(){			
			var othis=this,cfg=othis.config;	
			othis.oInitMoveWay[cfg.moveWay](othis);
			othis.movefunc=othis.oMoveWays[cfg.moveWay];
		},
		setStatus:function(){
			var othis=this,cfg=othis.config;
			othis.oItems.removeClass(cfg.itemCSSCurr);	
			othis.oItems.eq(cfg.pos).addClass(cfg.itemCSSCurr);
			othis.oOptions.removeClass(cfg.optionCSSCurr);
			othis.oOptions.eq(cfg.pos).addClass(cfg.optionCSSCurr);
		},
		oInitMoveWay:{
			 // moveWidth 移动宽度
			 moveWidth:function(e){
				 var othis=e,cfg=othis.config;
				 othis.itemValue=othis.config.itemWidth || othis.oItems.eq(0).outerWidth(true); 
				 othis.oPanel.css({"width":othis.itemValue*othis.sum});
				 othis.setPos();
				 othis.oPanel.css({"left":-cfg.pos*othis.itemValue});
				 othis.setStatus();
			},
			
			// moveNone:直接切换，没有特效
			moveNone:function(e){
				  var othis=e,cfg=othis.config;
					 othis.setPos();
					 othis.oItems.hide();
					 othis.oItems.eq(cfg.pos).show();
					 othis.setStatus();	
			},
			
			// moveOpacity 改变透明度
			moveOpacity:function(e){
					var othis=e,cfg=othis.config;
					 othis.setPos();
					 othis.oItems.hide();
					 othis.oItems.eq(cfg.pos).show();
					 othis.setStatus();	
			}
		},
		oMoveWays:{
			
			// moveNone:直接切换，没有特效
			moveNone:function(){
				var othis=this,cfg=othis.config;
				othis.setPos();
				othis.setStatus();
				othis.oItems.hide();
				othis.oItems.eq(cfg.pos).show();
			},
			
			// moveOpacity 改变透明度
			moveOpacity:function(){
				var othis=this,cfg=othis.config;
				othis.setPos();
				othis.oItems.hide();
				othis.oItems.eq(cfg.pos).fadeIn();
				othis.setStatus();
			}
			
		},
		fnDelay:function(e){
			var othis=(e && e.data) || this,oimgs;
			if(!othis.oDelayImgs){
				oimgs=othis.oslide.find("img");	
				othis.oDelayImgs=new Array();	
				oimgs.each(function(){
					if($(this).attr("orial_src")){othis.oDelayImgs.push(this);}	
				});		
			};
			var spos=othis.config.pos;
			if(spos>othis.oItems.length-1){spos=spos-othis.oItems.length;}
			oimgs=othis.oItems.eq(spos).find("img");
			
			var owin=$(window);	
			var scrollStart=owin.scrollTop(),winH=owin.height(),end=scrollStart+winH;
			
			var sum=oimgs.length;
			oimgs.each(function(){
				var oself=$(this);
				var offTop=parseInt(oself.offset().top);
				var offBottom=parseInt(offTop+(oself.outerHeight() || 800));
				if((offTop>=scrollStart && offTop <=end) || (offBottom>=scrollStart && offBottom <= end )){
					oself.attr("src",oself.attr("orial_src"));
					for(var i=0;i<othis.oDelayImgs.length;i++){
						if(othis.oDelayImgs[i]== this){othis.oDelayImgs.splice(i,1);i--;break;}	
					}
				}	
			});
			if(othis.oDelayImgs.length==0){ othis.config.onBeforeMove=null; $(window).unbind("resize"+othis._selfName+" scroll"+othis._selfName);}
		}	
	};
	$Slide.prototype.constructor=$Slide;
	$Slide._newNum=0;
	$Slide.play=function(o){
		var obj=new $Slide(o);
		obj.init();
		return obj;
	};

	

	function imgsilde(p){
	    var _config= p || {};
	    this.config={
	        container:$("#movetrip"),
	        ulID : $("#moveul1"),
	        liID : "li",
	        preBtn:".bff-trip-left",
	        nextBtn:".bff-trip-right",
	        disableBtn:"disable",
	        pos:0
	    }
	    for(var i in _config){
	        this.config[i]=_config[i];
	    }
	    this.num = this.config.container.find(this.config.liID).length;
	    this.len = this.config.container.find(this.config.liID).width();
	    this.leftBtn = this.config.container.find(this.config.preBtn);
	    this.rightBtn = this.config.container.find(this.config.nextBtn);
	    this.init();
	}
	imgsilde.prototype={        
	    init:function(){ 
	    	this.leftBtn.hide();      
	        
	        if( this.num ===1 ){
	        	
	        	this.rightBtn.hide();
	        }
	        this.leftBtn.bind("click",this,this.preHandler);
	        this.rightBtn.bind("click",this,this.nextHandler);
	    },
	    preHandler:function(e){
	        var that=e.data;   
	        that.config.pos--;            
	        that.getmove();        
	        that.setStaus();
	        return false;
	    },
	    nextHandler:function(e){
	        var that=e.data;   
	        that.config.pos++;    	
	       	that.getmove();       	
	        that.setStaus();
	       	return false;
	    },
	    getmove:function(){

	        this.config.ulID.animate({"left":-this.len*(this.config.pos)},500);
	        
	    },

	    setStaus:function(){
	        
	        this.config.pos >= this.num - 1  ? this.rightBtn.hide() : this.rightBtn.show();

	        this.config.pos == 0 ? this.leftBtn.hide() : this.leftBtn.show();
	    }
	}
	$getTpl = (function() {
		function a(h, g) {
			h = h.replace(/[\n\r]/g, "");
			var d = h.match(/<!--(.*?)\/\*(.*?)\*\/(.*?)\1-->/gi);
			var c = {};
			if (!d) {
				return [];
			}
			for (var f = 0; f
	    < d.length; f++) {
				var e = d[f].match(/(.*?)\/\*(.*?)\*\/(.*)\1/i);
				c[e[1]] = e[3].replace(/^\s*/, "").replace(/\d*$/, "");
			}
			return c;
		}
		return function(d) {
			var b = $id("tpl_" + d);
			var c = a( b ? b.innerHTML : "", true);
			return c;
		};
	})();
	function $id(id){
    	return typeof(id) == "string" ? document.getElementById(id) : id;
    }
    function $toJSON(obj) {
		var IS_DONTENUM_BUGGY = (function() {
			for (var p in {toString : 1}) {
				if (p === 'toString')
					return false;
			}
			return true;
		})();
		var DONT_ENUMS = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'];
		var _toString = Object.prototype.toString, _hasOwnProperty = Object.prototype.hasOwnProperty, NULL_TYPE = 'Null', UNDEFINED_TYPE = 'Undefined', BOOLEAN_TYPE = 'Boolean', NUMBER_TYPE = 'Number', STRING_TYPE = 'String', OBJECT_TYPE = 'Object', FUNCTION_CLASS = '[object Function]', BOOLEAN_CLASS = '[object Boolean]', NUMBER_CLASS = '[object Number]', STRING_CLASS = '[object String]', ARRAY_CLASS = '[object Array]', DATE_CLASS = '[object Date]', NATIVE_JSON_STRINGIFY_SUPPORT = window.JSON && typeof JSON.stringify === 'function' && JSON.stringify(0) === '0' && typeof JSON.stringify(function() {}) === 'undefined';
		return Str('', {'' : obj}, []);
		function Type(o) {
			switch(o) {
				case null:
					return NULL_TYPE;
				case (void 0):
					return UNDEFINED_TYPE;
			}
			var type = typeof o;
			switch(type) {
				case 'boolean':
					return BOOLEAN_TYPE;
				case 'number':
					return NUMBER_TYPE;
				case 'string':
					return STRING_TYPE;
			}
			return OBJECT_TYPE;
		}

		function Str(key, holder, stack) {
			var value = holder[key];
			if (Type(value) === OBJECT_TYPE && typeof value.toJSON === 'function') {
				value = value.toJSON(key);
			}
			var _class = _toString.call(value);
			switch (_class) {
				case NUMBER_CLASS:
				case BOOLEAN_CLASS:
				case STRING_CLASS:
					value = value.valueOf();
			}
			switch (value) {
				case null:
					return 'null';
				case true:
					return 'true';
				case false:
					return 'false';
			}
			var type = typeof value;
			switch (type) {
				case 'string':
					return inspectStr(value, true);
				case 'number':
					return isFinite(value) ? String(value) : 'null';
				case 'object':
					for (var i = 0, length = stack.length; i < length; i++) {
						if (stack[i] === value) {
							throw new TypeError("Cyclic reference to '" + value + "' in object");
						}
					}
					stack.push(value);
					var partial = [];
					if (_class === ARRAY_CLASS) {
						for (var i = 0, length = value.length; i < length; i++) {
							var str = Str(i, value, stack);
							partial.push( typeof str === 'undefined' ? 'null' : str);
						}
						partial = '[' + partial.join(',') + ']';
					} else {
						var keys = tokeys(value);
						for (var i = 0, length = keys.length; i < length; i++) {
							var key = keys[i], str = Str(key, value, stack);
							if ( typeof str !== "undefined") {
								partial.push(inspectStr(key,true) + ':' + str);
							}
						}
						partial = '{' + partial.join(',') + '}';
					}
					stack.pop();
					return partial;
			}
		}

		function inspectStr(str, useDoubleQuotes) {
			var specialChar = {
				'\b' : '\\b',
				'\t' : '\\t',
				'\n' : '\\n',
				'\f' : '\\f',
				'\r' : '\\r',
				'\\' : '\\\\'
			};
			var escapedString = str.replace(/[\x00-\x1f\\]/g, function(character) {
				if ( character in specialChar) {
					return specialChar[character];
				}
				return '\\u00' + toPaddedString(character.charCodeAt(), 2, 16);
			});
			if (useDoubleQuotes)
				return '"' + escapedString.replace(/"/g, '\\"') + '"';
			return "'" + escapedString.replace(/'/g, '\\\'') + "'";
		}

		function toPaddedString(num, length, radix) {
			var string = num.toString(radix || 10);
			return times('0', length - string.length) + string;
		}

		function times(str, count) {
			return count < 1 ? '' : new Array(count + 1).join(str);
		}

		function tokeys(object) {
			if (Type(object) !== OBJECT_TYPE) {
				throw new TypeError();
			}
			var results = [];
			for (var property in object) {
				if (_hasOwnProperty.call(object, property))
					results.push(property);
			}
			if (IS_DONTENUM_BUGGY) {
				for (var i = 0; property = DONT_ENUMS[i]; i++) {
					if (_hasOwnProperty.call(object, property))
						results.push(property);
				}
			}
			return results;
		}

	}
	function $formatTpl(tpl, data) {
		var code = "var p=[];with(obj){p.push(" + tpl.replace(/[\r\t\n]/g, " ").replace(/<%/g, '\t').replace(/%>/g, '\r').replace(/(^|\r)([^\t]*)(\t|$)/g, function($0, $1, $2, $3) {
			return $1 + $toJSON($2) + $3;
		}).replace(/\t\s*\=([^\r]*)\r/g, ');p.push($1);p.push(').replace(/\t([^\r]*)\r/g, ');$1\rp.push(') + ");}return p.join('');";
		var func = new Function("obj", code);
		return data ? func(data) : func;
	}




	function initDom(){
		var randomPic = [{'url':'http://breadtrip.com/trips/2387627278/#wp2404843347','pic1':'http://breadtripimages.qiniudn.com/photo_2013_07_09_5eade969372b49ee10e4cd5294ff5cf0.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2013_07_09_68361b5d8d56492e4fec55eacc9f3b93.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2013_07_09_ef7793bd0026c7757873bdb854051c32.jpg?imageView/2/w/960/q/85','name':'yaxiaoya1013','title':'泰美丽的姐妹团','see':15812,'colect':158,'comment':15},
			{'url':'http://breadtrip.com/trips/2388108635/#wp2415200167','pic1':'http://breadtripimages.qiniudn.com/photo_2014_07_01_e36cac11a2c36f975fc310fef898dedf.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2014_07_02_7c667f32c92c5df9c583d5f52f305a29.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2014_07_02_9934e0d6d7167e037028c10aaf249d2a.jpg?imageView/2/w/960/q/85','name':'miandle','title':'B Girls的韩国逗逼欢乐游','see':11302,'colect':294,'comment':17},
			{'url':'http://breadtrip.com/trips/2387948741/#wp2401564177','pic1':'http://breadtripimages.qiniudn.com/photo_2014_02_25_19964938f37d4579f9e569a6e31dec7b.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2014_02_25_16bef3a9abb46c99418467beb999b46a.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2014_02_25_eb59075fed49581999e08da3a16a20e2.jpg?imageView/2/w/960/q/85','name':'感悟90后','title':'四個妹子 台灣十二日窮游環島','see':13011,'colect':570,'comment':55},
			{'url':'http://breadtrip.com/trips/2387948108/#wp2401536150','pic1':'http://breadtripimages.qiniudn.com/photo_2014_03_02_d5bef049054d3606be35214f82ee50f4.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2014_02_25_0885cc8552eac46344b19110549a12cf.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2014_03_02_c7e252dfaf518cdb148a6b681865841c.jpg?imageView/2/w/960/q/85','name':'yoyo飞','title':'与闺蜜的缅甸之旅','see':8061,'colect':91,'comment':5},
			{'url':'http://breadtrip.com/trips/2387740178/#wp2412710467','pic1':'http://breadtripimages.qiniudn.com/photo_2014_06_10_5f071409c1b08a2f6bef8865b5fe5f2d.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2014_06_05_0d68aa31dd0fc6abd7cc357d91336c08.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2014_06_10_2804b505fb7974d28c8270144ad79a56.jpg?imageView/2/w/960/q/85','name':'深情的风大爷','title':'章鱼烧、银杏树与宫崎骏——首次日本之行','see':6952,'colect':200,'comment':8},
			{'url':'http://breadtrip.com/trips/2388110904/#wp2415186669','pic1':'http://breadtripimages.qiniudn.com/photo_2014_07_06_9f789a5bd623e9311a41ff533b24b388.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2014_07_06_afb6ce78d45aa7747bcae5a7dd2e2afb.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2014_07_05_b9340193c7d151b117a1279cc0a58346.jpg?imageView/2/w/960/q/85','name':'DoraHezi','title':'去东一时区玩小朋友','see':8511,'colect':54,'comment':13},
			{'url':'http://breadtrip.com/trips/2387882023/','pic1':'http://breadtripimages.qiniudn.com/photo_2014_05_03_57325e5f61b0de3ca9df4be34d2d333b.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2014_05_03_20280e050ff2679b987a089bd9b4310e.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2014_05_03_1f7751df4a205f46a55c501e0ec71b2e.jpg?imageView/2/w/960/q/85','name':'yaxiaoya1013','title':'姐妹的泡菜国疯狂游','see':2842,'colect':88,'comment':4},
			{'url':'http://breadtrip.com/trips/2387813094/#wp2406052457','pic1':'http://breadtripimages.qiniudn.com/photo_2013_08_21_36206d1cdb0888360830df87d6a27c33.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2013_08_21_2c9511c31944514dd14054ad58d15c7b.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2013_08_21_4ce8bb63433059f4e3baa9e4f0fb8f25.jpg?imageView/2/w/960/q/85','name':'陈颠颠','title':'姐姐妹妹闺蜜游-敦煌','see':1781,'colect':52,'comment':13},
			{'url':'http://breadtrip.com/trips/2387883035/#wp2411900027','pic1':'http://breadtripimages.qiniudn.com/photo_2014_05_20_e0265728cfcc5d4f58f8540bc05de531.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2014_05_21_2854f9445401be41a981e20376b0e3a4.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2014_05_26_7fa61ed51c45c1d7ecc17d98d17a70b0.jpg?imageView/2/w/960/q/85','name':'青之元素@柬埔寨','title':'那些消逝于岁月边缘的美好@柬埔寨','see':6428,'colect':150,'comment':35},
			{'url':'http://breadtrip.com/trips/2387901210/#wp2412224292','pic1':'http://breadtripimages.qiniudn.com/photo_2014_05_30_32749396bcac26b56732261a0525727f.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2014_05_30_bc6c356c79e8a88a00408c8e2834db81.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2014_05_30_769d8817231341491d56b3e57a255f0a.jpg?imageView/2/w/960/q/85','name':'ElvenLee','title':'初夏日本国','see':6802,'colect':178,'comment':14},
			{'url':'http://breadtrip.com/trips/2388105577/#wp2415134501','pic1':'http://breadtripimages.qiniudn.com/photo_2014_07_06_8abe724ff622b3257122c55ef70db25a.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2014_07_06_a3549f1b55b2e4c8966c7cc8caf5ad5b.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2014_07_06_149fb94ba0783c447f945094cb0cada4.jpg?imageView/2/w/960/q/85','name':'soledad','title':'Summer school in Poland','see':925,'colect':9,'comment':0},
			{'url':'http://breadtrip.com/trips/2387923451/#wp2413409269','pic1':'http://breadtripimages.qiniudn.com/photo_2014_04_22_910d5add4f428ae112bce46bead7404b.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2014_04_22_41fb3b34fabef3ad8ec990f74147b06a.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2014_04_22_621c4242434ec52da43650f15422fbe7.jpg?imageView/2/w/960/q/85','name':'潇洒十三仙儿','title':'24K新加坡女王暴走日记+无敌性价比一日游全攻略','see':8171,'colect':181,'comment':13},
			{'url':'http://breadtrip.com/trips/2387856023/#wp2405937548','pic1':'http://breadtripimages.qiniudn.com/photo_2014_07_10_cc9594e78a83f9c326db5ff9ba01779f.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2014_07_10_54e5664b46e84405d6c8ca9bf0c89b43.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2014_07_10_86041e2c7813a44bfa23970e1080afab.jpg?imageView/2/w/960/q/85','name':'AngelaWang1122','title':'Amazing in Korea','see':13683,'colect':300,'comment':28},
			{'url':'http://breadtrip.com/trips/2387872863/#wp2412219160','pic1':'http://breadtripimages.qiniudn.com/photo_2014_05_30_186d33bfb8af7c1b79c1584fac46fc5d.jpg?imageView/2/w/960/q/85','pic2':'http://breadtripimages.qiniudn.com/photo_2014_05_30_e615bf241c501251f79b195914160b2b.jpg?imageView/2/w/960/q/85','pic3':'http://breadtripimages.qiniudn.com/photo_2014_06_06_0720e8d7da1374698c9f1007a5381245.jpg?imageView/2/w/960/q/85','name':'刘思霞','title':'锡兰•发现之旅','see':3499,'colect':48,'comment':2}
		]
		function attr(arry){
	    	var num = 4,len = arry.length - 1,trips = [];
	    	for(var i = 0; i < num; i++){
	    		var randomNum = parseInt(Math.floor(Math.random()*len));
	    		len--;
	    		var a = randomPic.splice(randomNum,1);
	    		trips.push(a[0]);
	    	}
	    	return trips;
	    }
	    tripsData = attr(randomPic);
		var dom = $id("temp"),tp = $getTpl("trip");
   		dom.innerHTML = $formatTpl(tp.tripsList,{list:tripsData});
	}

	initDom();
	//创建实例
	var oBanner=$Slide.play({oslide:"#slide",config:{auto:true,moveWay:"moveOpacity",isDelay:false,panelSelector:"#slides",itemsSelector:"li",optionsSelector:"#option",optionSelector:"span",optionCSSCurr:"on",delay:4000}});

	var trip1 = new imgsilde({container:$("#movetrip1"),ulID:$("#moveul1")});
	var trip2 = new imgsilde({container:$("#movetrip2"),ulID:$("#moveul2")});
	var trip3 = new imgsilde({container:$("#movetrip3"),ulID:$("#moveul3")});
	var trip4 = new imgsilde({container:$("#movetrip4"),ulID:$("#moveul4")});

    

})()

